/*******************************************************************************
 * Copyright (c) 2008 Nels E. Beckman.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Nels E. Beckman - initial API and implementation
 *******************************************************************************/
package edu.cmu.cs.nbeckman.wptranslator;

import java.util.Collections;
import java.util.List;

/**
 * A list of elements.
 * 
 * @author Nels E. Beckman
 */
public class ElementList implements Element {

	private final List<Element> elements;
	
	public ElementList(List<Element> elements) {
		this.elements = Collections.unmodifiableList(elements);
	}
	
	@Override
	public String drawAsHTML() {
		StringBuffer buf = new StringBuffer();

		for( Element elem : this.elements ) {
			buf.append(elem.drawAsHTML());
		}
		
		return buf.toString();
	}

	/**
	 * Primarily for testing. 
	 * @return 
	 */
	List<Element> getElements() {
		return this.elements;
	}

	@Override
	public String drawAsRTF() {
		StringBuffer buf = new StringBuffer();
		
		for( Element elem : this.elements ) {
			buf.append(elem.drawAsRTF());
		}
		
		return buf.toString();
	}

}
